<script type="text/javascript">var do_special = false;</script>

<?php if ($this->lang->lang() == 'me' || $this->lang->lang() == 'ru' || $this->lang->lang() == 'de'): ?>

<style type="text/css">.popular-title {font-size:28px; margin-top: 4px;}</style>
<?php endif; ?>


<style type="text/css">
    .holder .special-deals a
    {
        display: block;
        background:url(<?= base_url() ?>assets/img/backgnds/special-deals_<?= $this->lang->lang() ?>.jpg) no-repeat;
        width:21px;
        height: 125px;
    }
</style>


<div class="holder clearfix home-banner">

    <div class="box special-offer big-box2">

        <ul class="bxslider" id="special_popular">
            <?php $this->load->view('home/special_offer_destinations') ?>
            <?php $this->load->view('home/special_offer_objects') ?>
        </ul>

    </div>

    <?php $this->load->view('booking/search-box'); ?>

</div>

<?php if (count($specialHotels) > 1 || count($specialDests) > 1): ?><script type="text/javascript">var do_special = true;</script><?php endif; ?>

<div class="holder clearfix popular">
    <div class="col-1 clearfix">

        <div  class="popular-title"><?= lang('home.popular') ?></div>


        <?php
            $cnt = 1;
            if (isset($popular) &&!empty($popular))
            foreach ($popular as $destination):
            if($cnt++>4)
            break;
        ?>

        <div class="popular-box">

            <!-- ADDED DURING CURRENCY UPGRADE -->
            <?php
                $currency = isset($_GET['currency']) ? '&currency=' . $_GET['currency'] : '';
                $link_dest = base_url('search?dest_hot=' . strtolower($destination->name) . '&preview=1' . $currency);
            ?>
            <!-- END ADDED -->

            <div class="image">
                <a href="<?= $link_dest ?>">
                    <?php $thumbnail = $host_url . 'destinations/' . $destination->photo_path . '/thumb_262x230/' . $destination->photo_name; ?>
                    <img src="<?= $thumbnail ?>" alt="<?= $destination->name; ?>" width="262" height="230" />
                </a>
            </div>

            <div class="text">
                <div class="title"><a href="<?= $link_dest ?>"><?= $destination->name ?></a></div>
                <div class="subtitle">
                    <a href="<?= $link_dest . '&acc_type=hotel'; ?>"><? echo($destination->hotels_count . " " . lang('home.hotels')) ?></a>,
                    <a href="<?= $link_dest . '&acc_type=appartment'; ?>"><? echo($destination->accommodations_count . " " . lang('home.accommodation')) ?></a>
                </div>
            </div>

        </div>

        <? endforeach; ?>

    </div>
    <div class="col-2 clearfix">

        <div class="popular-title"><?= lang('home.most_viewed') ?></div>


        <?php
            $cnt = 1;
            if (isset($visited) &&!empty($visited))
            foreach ($visited as $hotel):
            if($cnt++>4)
            break;
        ?>

        <div class="popular-box popular-hotels">


            <!-- ADDED BY MARKO -->
            <?php
                $currency = isset($_GET['currency']) ? '&currency=' . $_GET['currency'] : '';

                $link_dest = base_url('search?dest_hot=' . strtolower($hotel->destination_name) . '&preview=1' . $currency);

                $obj_name = URLify::filter($hotel->object_name);
                $link_hotel = base_url('accommodation/' . $obj_name . '-' . $hotel->object_ID . '?preview=1&room_id=' . $hotel->lowest_price_room_id . $currency);
            ?>

            <!-- END ADDED -->



            <div class="arrow"><a href="<?= $link_hotel ?>"></a></div>

            <div class="image"><a href="<?= $link_hotel ?>">
                    <?php $thumbnail = $host_url . $hotel->photo_path . '/thumb_262x155/' . $hotel->photo_name; ?>
                    <img src="<?= $thumbnail ?>" alt="<?= $hotel->object_name; ?>" width="262" height="155" />
                </a></div>

            <div class="text">

                <div class="title"><a href="<?= $link_hotel ?>"><?php
                            $str = clean_html($hotel->object_name);

                            if ($hotel->category_name == "Special offer") {
                            $lng = 15;
                            } else {
                            $lng = 19;
                            }

                            if (mb_strlen($str) > $lng) {
                            $str = mb_substr($str, 0, $lng) . '...';
                            }
                            echo $str;
                        ?></a></div>
                <div class="subtitle"><a href="<?= $link_dest ?>"><?= $hotel->destination_name ?></a></div>
                <? if ($hotel->object_number_of_stars != ""): ?>
                <div class="star-5-medium star-<?= $hotel->object_number_of_stars ?>"></div>
                <? endif; ?>
            </div>

            <div class="p_foot">
                <a href="<?= $link_hotel ?>" class="p_bn"><?= lang('hotel.book_now') ?></a>
                <? if ($hotel->lowest_price != "" && $hotel->lowest_price != 0): ?>
                <?= currency_sign() ?><?= round($hotel->lowest_price) ?>
                <? endif; ?>
            </div>

        </div>

        <? endforeach; ?>

    </div>
</div>

<div class="holder clearfix popular"  style="display:none">

    <div class="popular-title" style="float: none"><?= lang('home.info_title') ?><span style="font-family: Arial; font-size: 33px;">?</span></div>

    <div class="why_book clearfix">
        <div>
            <ul>
                <li><?= lang('home.info1') ?></li>
                <li><?= lang('home.info2') ?></li>
                <li><?= lang('home.info3') ?></li>
            </ul>
        </div>
        <div>
            <ul>
                <li><?= lang('home.info4') ?></li>
                <li><?= lang('home.info5') ?></li>
                <li><?= lang('home.info6') ?></li>
            </ul>
        </div>

    </div>

</div>

<div class="holder clearfix popular">

    <div class="popular-title"><?= lang('home.we_recommend') ?></div>

    <div class="we_recommend clearfix">
        <ul>
            <?php
                $cnt = 1;
                if (isset($recommended) &&!empty($recommended))
                foreach ($recommended as $hotel):
                if($cnt++>4)
                break;
            ?>

            <li class="popular-box">

                <!-- ADDED BY MARKO -->
                <?php
                    $currency = isset($_GET['currency']) ? '&currency=' . $_GET['currency'] : '';

                    $obj_name = URLify::filter($hotel->object_name);
                    $link_hotel = base_url('accommodation/' . $obj_name . '-' . $hotel->object_ID . '?preview=1&room_id=' . $hotel->lowest_price_room_id . $currency);
                ?>

                <!-- END ADDED -->

                <div class="image">
                    <a href="<?= $link_hotel ?>">
                        <?php $thumbnail = $host_url . $hotel->photo_path . '/thumb_262x230/' . $hotel->photo_name; ?>
                        <img src="<?= $thumbnail ?>" alt="<?= $hotel->object_name; ?>" width="262" height="230" />
                    </a>
                </div>
                <a href="<?= $link_hotel ?>" class="p_foot elipsis">
                    <?php
                        $str = clean_html($hotel->object_name);
                        $lng = 40;
                        if (mb_strlen($str) > $lng) {
                        $str = mb_substr($str, 0, $lng) . '...';
                        }
                        echo $str;
                    ?>
                </a>
                <div class="more-info"><?= currency_sign() . $hotel->lowest_price; ?></div>
            </li>


            <?php endforeach; ?>

        </ul>


    </div>

</div>